package cn.com.nes.site.entity.em.crm.clue;

import cn.com.nes.common.exception.NoSuchEnumException;

import java.util.HashMap;
import java.util.Map;

/**
 * 线索认领列别 枚举
 */
public enum ClueClaimTypeEnum {

    NOT_CLAIM("0", "不认领"),
    CLAIM("1", "认领"),

    ;

    private String key;

    private String value;

    ClueClaimTypeEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static ClueClaimTypeEnum getEnum(String key) {
        Map<String, ClueClaimTypeEnum> map = new HashMap<>();
        for (ClueClaimTypeEnum cluePoolEntryEnum : values()) {
            map.put(cluePoolEntryEnum.getKey(), cluePoolEntryEnum);
        }
        if (!map.containsKey(key)) {
            throw new NoSuchEnumException("未匹配的线索阶段类型");
        }
        return map.get(String.valueOf(key));
    }

}
